export default {
    data() {
        const def_ctime = this.parseTime(
            new Date() - 3600 * 1000 * 24 * 3, "{y}-{m}-{d}"
        );
        const def_ltime = this.parseTime(new Date(), "{y}-{m}-{d}");
        return {
            pickerOptions: {
                disabledDate(time) {
                    const start = new Date();
                    return time.getTime() >= start;
                },
                shortcuts: [
                    {
                        text: "近一天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 1
                            );
                            picker.$emit("pick", [start, end]);
                        }
                    },
                    {
                        text: "近两天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 2
                            );
                            picker.$emit("pick", [start, end]);
                        }
                    },
                    {
                        text: "近三天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 3
                            );
                            picker.$emit("pick", [start, end]);
                        }
                    },
                    {
                        text: "近七天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 7
                            );
                            picker.$emit("pick", [start, end]);
                        }
                    },
                    {
                        text: "近30天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 30
                            );
                            picker.$emit("pick", [start, end]);
                        }
                    }
                ]
            },
        }
    }
}